package common

import (
	"github.com/astaxie/beego/logs"
	"github.com/astaxie/beego/session"
)

var (
	globalSessions *session.Manager
	managerConfig  *session.ManagerConfig
)

func InitSessionConfig() {
	managerConfig = new(session.ManagerConfig)
	managerConfig.CookieName = "gosessionid"
	managerConfig.EnableSetCookie = true
	managerConfig.Gclifetime = 3600
	managerConfig.Maxlifetime = 3600
	managerConfig.Secure = false
	managerConfig.CookieLifeTime = 3600
	managerConfig.ProviderConfig = ".tmp"
	managerConfig.SessionIDPrefix = "web_"
	globalSessions, _ = session.NewManager("memory", managerConfig)
	go globalSessions.GC()
	logs.Info("init session config success")
}
